package io.scnb.lesson003.demo1.test0.userregister;

import io.scnb.lesson003.demo1.test0.event.EventMulticaster;

public class UserRegisterService {
    // 事件发布者
    private EventMulticaster eventMulticaster;
    
    public void registerUser(String userName) {
        // 用户注册（将用户信息入库等操作）
        System.out.println(String.format("用户【%s】注册成功", userName));
        // 广播事件
        this.eventMulticaster.multicastEvent(new UserRegisterSuccessEvent(this, userName));
    }

    public EventMulticaster getEventMulticaster() {
        return eventMulticaster;
    }

    public void setEventMulticaster(EventMulticaster eventMulticaster) {
        this.eventMulticaster = eventMulticaster;
    }
}
